package com.project.service.impl;

import com.project.bean.OrderBean;
import com.project.bean.ShopBean;
import com.project.mapper.IOrderMapper;
import com.project.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Map;

@Service
@Transactional
public class OrderServiceImpl implements IOrderService {
    @Autowired
    private IOrderMapper mapper;
    @Override
    public void addOrder(OrderBean order, Map<Integer, ShopBean> shopMap) {
        mapper.addOrder(order);
        mapper.addOrderInfo(order.getId(), shopMap.values());
    }
}
